<template>
  <div id="app">
    <!-- <m-parent :msga="a" :msgb="b" :msgc="c"></m-parent>
    <button @click="passMsg">总线</button>
    <router-link to="/about">About</router-link>
    <button @click="toAbout">AboutBtn</button> -->
    <!--要通过这个显示路由里面定义的组件-->
    <router-view></router-view>
  </div>
</template>
<script>
import bus from "./util/bus";
import MParent from "./views/Parent";

export default {
  data() {
    return {
      a: "msga",
      b: "msgb",
      c: "msgc",
    };
  },
  //vcomponents 会快速生成
  components: {
    MParent,
  },
  methods: {
    passMsg() {
      //总线传递数据 msg
      bus.$emit("msg", "i am from app");
    },
    toAbout(){
      //函数式跳转
      this.$router.push({path: '/about'});
    }
  },
};
</script>
